<?php
if (!defined('_THRIFT_CLIENT')) {
	include "ThriftClient.php";
}

//include $GLOBALS['THRIFT_ROOT'] . '/packages/blog/blog.php';

require_once $GLOBALS['THRIFT_ROOT'].'/Thrift.php';
require_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/THttpClient.php';
require_once $GLOBALS['THRIFT_ROOT'].'/packages/blog/blog.php';

class BlogService extends ThriftClient {
  
  public function __construct($server, $port){
    if (!isset($server)||!isset($port))
      return false;
      
    try {
      /*
      $this->_socket = new TSocket($server, $port);
      $this->_transport = new TBufferedTransport($this->_socket, 1024, 1024); 
      $this->_protocol = new TBinaryProtocol($this->_transport);
      $this->_client_instance = new blogClient($this->_protocol);
      */
        $this->_transport = new THttpClient('10.1.254.120', '8003', 'blogapi.php');
        $this->_protocol = new TBinaryProtocol($this->_transport);
        $this->_client_instance = new blogClient($this->_protocol);  
      
    } catch (TException $tx){
      
      return false;
    }
    
    return true;
  }
}

